package downpacket

import "gitee.com/yanwc/ebike-xiaoan-device/internal/field"

type VoiceFileType string

const (
	Amr VoiceFileType = "amr"
	Wav VoiceFileType = "awv"
	Mp3 VoiceFileType = "mp3"
)

type VoiceIdx int

const (
	VoiceLockSuccess   VoiceIdx = 1
	VoiceUnLockSuccess VoiceIdx = 2

	VoiceTemporaryLockSuccess VoiceIdx = 7
	VoiceOutDistrict          VoiceIdx = 8
	VoiceSeek                 VoiceIdx = 9
	VoiceBroken               VoiceIdx = 16
	VoiceDistrictEdge         VoiceIdx = 19
	VoiceFail                 VoiceIdx = 35
)

type PlayVoiceReq struct {
	Idx    VoiceIdx      `json:"idx"`
	Volume int           `json:"volume"`
	Url    string        `json:"url"`
	CRC    int           `json:"crc"`
	Type   VoiceFileType `json:"type"`
}

func NewPlayVoiceReq(sn field.SerialNumber, req PlayVoiceReq) *Req[PlayVoiceReq] {
	return &Req[PlayVoiceReq]{
		CmdWord: PlayVoiceCommandWord,
		MsgNo:   sn,
		Param:   req,
	}
}
